import Vue from 'vue'
import Vuex from 'vuex'
import api from '../api/index'
Vue.use(Vuex);
export default new Vuex.Store({
  state: {
    user: {user_id:null, user_number:'',name:'',fk_classId:null,sex:'',user_type:'学生',isAdmin:0},
    signList:[]
  },
  mutations: {
    // 用户状态行为
    set_user (state,user) {
      state.user = user;
    },
    //用户注销
    del_user (state,user) {
      state.user=user;
    },
    get_signList(state,signList){
      state.signList=signList
    }
  },
  actions:{
    getSignList(context,classId){
      api.getSignListByClassGuid(classId.classId).then(res=>{
         if(res.status==1){
           context.commit('get_signList',res.data);
         }
      })
    }
  }
})
